Last chance! 50% off unlimited learning
Sale ends in
gcd(a, b, extended = FALSE)
Lcm(a, b)
TRUE
the extended Euclidean algorithm will be applied.c, d, g
, g containing the greatest common divisors, such that g = c * a + d * b
.
If both a
and b
are vectors of the same length, the greatest
common divisor/lowest common multiple will be computed elementwise.
If one is a vektor, the other a scalar, the scalar will be replicated to
the same length.
numbers::extGCD
gcd(12, 1:24)
gcd(46368, 75025) # Fibonacci numbers are relatively prime to each other
Lcm(12, 1:24)
Lcm(46368, 75025) # = 46368 * 75025
Run the code above in your browser using DataLab